<?
	include_once ("../include/conn.php");
	include_once ('config.php');
	
	/**************************************
	 * ************ 用户问卷历史 ***********
	 * ************************************/

	//开始数据处理
	$unionid      = $_POST['unionid'];
	$openid       = $_POST['openid'];
	$results = array('code' => 0,'msg'=>'问卷历史数据正常获取！');//用于正常有数据输出的

	$cmd = "select qn.id,qn.qn_no,qn.unionid,qn.sid,qn.datetime,s.name s_name from {$TABLE_C}vote_qn qn 
	left join(select * from {$TABLE_C}vote_series) s on s.id=qn.sid 
	where qn.unionid = '$unionid' 
	order by id desc limit 0,5
	";
	$rs = mysql_query($cmd);

	// 遍历结果
	while ($row = mysql_fetch_assoc($rs)) {
		$results['dataList'][] = $row;
	}

	// //////////////////输出数据////////////////////////////////
	echo json_encode($results);
	mysql_close();
?>